package main

import (
	"fmt"
	"os"
)

var m = make(map[int]int, 1000)

func fib(n int) int {
	if n < 0 {
		fmt.Println("n不能是负数")
		os.Exit(2)
	} else if n == 0 {
		m[0] = 0
	} else if n < 3 {
		m[n] = 1
	}
	if _, ok := m[n]; !ok {
		m[n] = fib(n-1) + fib(n-2)
	}
	return m[n]
}

func main() {
	s := fmt.Sprintln(fib(50))
	fmt.Println(s)

}
